﻿using System;
using System.Web;
using System.Web.Mvc;
using YawetagDemo.WebUI.Controllers;
using YawetagDemo.WebUI.Startup;

namespace YawetagDemo.WebUI
{
    public class MvcApplication : HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters();
            RouteConfig.RegisterRoutes();
            FacadeConfig.RegisterLocator();
            ControllerBuilder.Current.SetControllerFactory(typeof(ControllerFactory));
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            FacadeConfig.Initialize();
        }
    
        protected void Application_EndRequest(object sender, EventArgs e)
        {
            FacadeConfig.Release();
        }
    }
}